<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	checkConfig(out, request, response);

	String act = request.getParameter("act");
	if("login".equals(act)){
	    String pwd = request.getParameter("pwd");
	    if(password.equals(pwd)){
	        setLogin(request, pwd);
	        printScript(out, "alert('登录成功');");
	        response.sendRedirect("index.jsp");
	    }
	    else {
	        printScript(out, "alert('登录失败');");
	    }
	}
%>
<%@include file="header.jsp" %>
	<form id="loginForm" method="POST" action="login.jsp?act=login">
		<table class="infotable">
			<tr>
				<td colspan="2" class="partition">密码未设置</td>
			</tr>
			<tr>
				<td class="fieldlabel" style="width:60px;">名称</td>
				<td>
					<input name="pwd" id="pwd" type="password" class="textinput" style="width:98%"/>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;">
					<input type="button" class="btn" value=" 登录 " onclick="doLogin();"/>
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">
		function doLogin(){
			var pwd = document.getElementById('pwd').value;
			if(!pwd){
				alert('请输入密码');
				return;
			}
			document.getElementById('loginForm').submit();
		}
	</script>
<%@include file="footer.jsp"%>